package com.fowo.api.common.model;

import java.io.Serializable;

/**
 * 一个 API 包装错误，直接返回 API 包装
 */
public class RException extends RuntimeException implements Serializable {

    public RException() {
        this(R.fail("操作失败"));
    }

    public RException(String message) {
        super(message);
    }

    public RException(R r) {
        super(r.getErrorMessage());
    }

    public R getResult() {
        return R.fail(getLocalizedMessage());
    }
}
